package com.meeting.controller.admin;



import com.meeting.entity.Notice;
import com.meeting.service.NoticeService;
import com.meeting.vo.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/notice")
@Tag(name = "管理员公告管理接口")
@Slf4j
public class AdminNoticeController {

    @Autowired
    private NoticeService noticeService;

    @PostMapping("/save")
    @Operation(summary = "添加公告")
    public Result saveNotice(@RequestBody Notice notice) {
        log.info("添加公告：{}", notice);
        return noticeService.saveNotice(notice);
    }

    @PutMapping("/update")
    @Operation(summary = "更新公告")
    public Result updateNotice(@RequestBody Notice notice) {
        log.info("更新公告：{}", notice);
        return noticeService.updateNotice(notice);
    }

    @DeleteMapping("/delete/{id}")
    @Operation(summary = "删除公告")
    public Result deleteNotice(@PathVariable Integer id) {
        log.info("删除公告，ID：{}", id);
        return noticeService.deleteNotice(id);
    }
}